package gui;

import static gui.BvViewI.*;
import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class TablePanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3678856278110810199L;
	JScrollPane scrollPane;
	JTable dataTable;
	
	public TablePanel() {
		super();
		this.setPreferredSize(new Dimension(TABLE_PANE_WIDTH, TABLE_PANE_HEIGHT));
		
		this.dataTable = new JTable();
		// Create a scroll pane.
		this.scrollPane = new JScrollPane();
		scrollPane.add(dataTable);
		scrollPane.setPreferredSize(new Dimension(RESULT_PANE_WIDTH,RESULT_PANE_HEIGHT));
		scrollPane.getViewport().add(dataTable);
		this.add(scrollPane);
		
	}
	public void updateTable(JTable table) {
		this.dataTable = table;
		scrollPane.getViewport().add(dataTable);
		scrollPane.revalidate();
		scrollPane.repaint();
	}
}
